package com.nts.visionworks.business.contents.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import com.nts.visionworks.business.application.domain.ApplicationMenuContents;
import com.nts.visionworks.business.schedule.domain.ScheduleStageDivision;
import com.nts.visionworks.core.validation.EntityIdNotNull;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Range;

/**
 * Contents generated by hbm2java
 */
@Entity
@Table(name = "contents", catalog = "visionworks")
public class Contents implements java.io.Serializable
{

	private Long contentsId;
	private ContentsTemplate contentsTemplate;
	private String contentsName;
	private short contentsStatus;
	private boolean deleted;
	private String tagString;
	private Date createdDateTime;
	private long creatorId;
	private Date updatedDateTime;
	private Set<ContentsElement> contentsElements = new HashSet<ContentsElement>(
			0);
	private Set<ContentsAttribute> contentsAttributes = new HashSet<ContentsAttribute>(
			0);
	private Set<ScheduleStageDivision> scheduleStageDivisions = new HashSet<ScheduleStageDivision>(
			0);
	private Set<ApplicationMenuContents> applicationMenuContentses = new HashSet<ApplicationMenuContents>(
			0);
	private ContentsDelegatedThumbnail contentsDelegatedThumbnail;

	public Contents()
	{
	}

	public Contents(ContentsTemplate contentsTemplate, String contentsName,
			short contentsStatus, boolean deleted, Date createdDateTime,
			long creatorId)
	{
		this.contentsTemplate = contentsTemplate;
		this.contentsName = contentsName;
		this.contentsStatus = contentsStatus;
		this.deleted = deleted;
		this.createdDateTime = createdDateTime;
		this.creatorId = creatorId;
	}

	public Contents(ContentsTemplate contentsTemplate, String contentsName,
			short contentsStatus, boolean deleted, String tagString,
			Date createdDateTime, long creatorId, Date updatedDateTime,
			Set<ContentsElement> contentsElements,
			Set<ContentsAttribute> contentsAttributes,
			Set<ScheduleStageDivision> scheduleStageDivisions,
			Set<ApplicationMenuContents> applicationMenuContentses,
			ContentsDelegatedThumbnail contentsDelegatedThumbnail)
	{
		this.contentsTemplate = contentsTemplate;
		this.contentsName = contentsName;
		this.contentsStatus = contentsStatus;
		this.deleted = deleted;
		this.tagString = tagString;
		this.createdDateTime = createdDateTime;
		this.creatorId = creatorId;
		this.updatedDateTime = updatedDateTime;
		this.contentsElements = contentsElements;
		this.contentsAttributes = contentsAttributes;
		this.scheduleStageDivisions = scheduleStageDivisions;
		this.applicationMenuContentses = applicationMenuContentses;
		this.contentsDelegatedThumbnail = contentsDelegatedThumbnail;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ContentsId", unique = true, nullable = false)
	public Long getContentsId()
	{
		return this.contentsId;
	}

	public void setContentsId(Long contentsId)
	{
		this.contentsId = contentsId;
	}

	@EntityIdNotNull(message = "validation.contents.templateid.notnull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TemplateId", nullable = false)
	public ContentsTemplate getContentsTemplate()
	{
		return this.contentsTemplate;
	}

	public void setContentsTemplate(ContentsTemplate contentsTemplate)
	{
		this.contentsTemplate = contentsTemplate;
	}

	@NotNull(message = "validation.contents.contentsname.notnull")
	@Range(message = "validation.contents.contentsname.length", min = 1, max = 40)
	@Column(name = "ContentsName", nullable = false, length = 40)
	public String getContentsName()
	{
		return this.contentsName;
	}

	public void setContentsName(String contentsName)
	{
		this.contentsName = contentsName;
	}

	@Column(name = "ContentsStatus", nullable = false)
	public short getContentsStatus()
	{
		return this.contentsStatus;
	}

	public void setContentsStatus(short contentsStatus)
	{
		this.contentsStatus = contentsStatus;
	}

	@Column(name = "Deleted", nullable = false)
	public boolean isDeleted()
	{
		return this.deleted;
	}

	public void setDeleted(boolean deleted)
	{
		this.deleted = deleted;
	}

	@Column(name = "TagString", length = 4000)
	public String getTagString()
	{
		return this.tagString;
	}

	public void setTagString(String tagString)
	{
		this.tagString = tagString;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CreatedDateTime", nullable = false, length = 19)
	public Date getCreatedDateTime()
	{
		return this.createdDateTime;
	}

	public void setCreatedDateTime(Date createdDateTime)
	{
		this.createdDateTime = createdDateTime;
	}

	@Column(name = "CreatorId", nullable = false)
	public long getCreatorId()
	{
		return this.creatorId;
	}

	public void setCreatorId(long creatorId)
	{
		this.creatorId = creatorId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UpdatedDateTime", length = 19)
	public Date getUpdatedDateTime()
	{
		return this.updatedDateTime;
	}

	public void setUpdatedDateTime(Date updatedDateTime)
	{
		this.updatedDateTime = updatedDateTime;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "contents")
	public Set<ContentsElement> getContentsElements()
	{
		return this.contentsElements;
	}

	public void setContentsElements(Set<ContentsElement> contentsElements)
	{
		this.contentsElements = contentsElements;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "contents")
	public Set<ContentsAttribute> getContentsAttributes()
	{
		return this.contentsAttributes;
	}

	public void setContentsAttributes(Set<ContentsAttribute> contentsAttributes)
	{
		this.contentsAttributes = contentsAttributes;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "schedule_stage_contents", catalog = "visionworks", joinColumns =
	{ @JoinColumn(name = "ContentsId", nullable = false, updatable = false) }, inverseJoinColumns =
	{ @JoinColumn(name = "DivisionId", nullable = false, updatable = false) })
	public Set<ScheduleStageDivision> getScheduleStageDivisions()
	{
		return this.scheduleStageDivisions;
	}

	public void setScheduleStageDivisions(
			Set<ScheduleStageDivision> scheduleStageDivisions)
	{
		this.scheduleStageDivisions = scheduleStageDivisions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "contents")
	public Set<ApplicationMenuContents> getApplicationMenuContentses()
	{
		return this.applicationMenuContentses;
	}

	public void setApplicationMenuContentses(
			Set<ApplicationMenuContents> applicationMenuContentses)
	{
		this.applicationMenuContentses = applicationMenuContentses;
	}

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "contents")
	public ContentsDelegatedThumbnail getContentsDelegatedThumbnail()
	{
		return this.contentsDelegatedThumbnail;
	}

	public void setContentsDelegatedThumbnail(
			ContentsDelegatedThumbnail contentsDelegatedThumbnail)
	{
		this.contentsDelegatedThumbnail = contentsDelegatedThumbnail;
	}

}
